package com.study.design.composite;

import com.study.design.LogUtil;

import lombok.extern.slf4j.Slf4j;


/**
 * @version V1.0
 * @title: Leaf
 * @description: 叶子
 * @author: wanghuilong
 * @date: 2019-07-29 10:24
 * @copyright: http://fingo.com.my/
 */
@Slf4j
public class Leaf extends Component {
    public Leaf(String name) {
        super(name);
        log.info("addLogStart Leaf InputParam: name : {} ", name);
    }

    @Override
    public void Add(Component c) {
        log.info("addLogStart Add InputParam: c : {} ", c);
        LogUtil.info("Cannot add to a leaf");
    }

    @Override
    public void Remove(Component c) {
        log.info("addLogStart Remove InputParam: c : {} ", c);
        LogUtil.info("Cannot remove from a leaf");
    }

    @Override
    public void Display(Integer depth) {
        log.info("addLogStart Display InputParam: depth : {} ", depth);
        LogUtil.info("---" + depth + "," + name);
    }
}
